<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html 
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h3 class="title">Boletim de Cadastro Imobiliário</h3>
            <script>
                function scrollnext(){
               
                }
            
                $(document).ready(function(){
                    var body = $("html, body");
                    $('#top').on('click', function(){
                        body.animate({scrollTop:0}, '500', 'swing', function() {});
                    });
                
                    $('#bottom').on('click', function(){
                        $('html, body').animate({
                            scrollTop: $("#bottom").offset().top
                        }, 300);
                    });
                });
            </script>

            <h:form id="realtyForm"  enctype="multipart/form-data" prependId="false">
                <div style="text-align: center">
                    
                    <p:commandButton id="salvar" value="Salvar" icon="ui-icon-disk"
                                     update="@form" action="#{managerImovel.atualizar()}" />
                </div>
                
                <p:growl showDetail="false" autoUpdate="true" life="999999"/>


                <h5 class="title">Dados Gerais</h5>
                <fieldset>
                    <legend>Inscrição Cadastral</legend>
                    <p:panel id="realtyPanel" style="background: none; border: none;"
                             styleClass="container_24 clearfix ">
                        <p:outputLabel value="Localização:" styleClass="grid_3" for="masklocalizacao" />
                        <p:inputMask mask="99.99.999.9999.99" id="masklocalizacao" styleClass="grid_6"
                                     value="#{managerImovel.localizacao}" />
                        <p:commandButton id="bt_next" style="margin-left: -10px;" icon="ui-icon-seek-next" 
                                         styleClass="grid_2" process="@this, masklocalizacao"
                                     update="@form" action="#{managerImovel.prox()}" />
                        
                        <p:outputLabel value="Inscrição Imóvel:" styleClass="grid_3" for="maskinscricao" />
                        <p:inputText id="maskinscricao" styleClass="grid_6" value="#{managerImovel.imovel.id}" />

                        <!--                        <p:outputLabel value="Fator Localização:" styleClass="grid_3" for="fInputText" />
                                                <p:inputText id="fInputText" styleClass="grid_6" 
                                                             value="{managerImovel.imovel.fatorLocalizacao}" />-->
                    </p:panel>
                </fieldset>

                <fieldset>
                    <legend>Contribuinte</legend>
                    <p:panel id="contribuintePanel" style="background: none; border: none;" 
                             styleClass="container_24 clearfix ">

                        <p:outputLabel styleClass="grid_3" for="cpfCnpjInputMask"
                                       value="CPF/CNPJ:" />
                        <p:inputText id="cpfCnpjInputMask" styleClass="grid_6" 
                                     value="#{managerImovel.imovel.codigoDoContribuinte.cpfOuCnpj}" />

                        <p:commandButton icon="ui-icon-search" styleClass="icon-only" alt="Pesquisar CPF" title="Pesquisar CPF" 
                            onclick="window.open('http://192.168.0.11:8080/Registro-war/?search=#{managerImovel.imovel.codigoDoContribuinte.nome}')"/>
                        <div class="clear-both" />

                        <p:outputLabel styleClass="grid_3" for="nomeInputText" value="Nome:"/>
                        <p:inputText id="nomeInputText" styleClass="grid_19" 
                                     value="#{managerImovel.imovel.codigoDoContribuinte.nome}" />

                        <p:outputLabel styleClass="grid_3" for="rgInputText"
                                       value="Outros Docs.:" />
                        <p:inputText id="rgInputText" styleClass="grid_4" value="#{managerImovel.imovel.codigoDoContribuinte.outrosDocs}" />
                    </p:panel>
                </fieldset>

                <fieldset>
                    <legend>Localização Imóvel</legend>
                    <p:panel id="localPanel" style="background: none; border: none;" 
                             styleClass="container_24 clearfix ">

                        <p:outputLabel value="CEP:" styleClass="grid_3" for="cepInputMask" />
                        <p:inputMask id="cepInputMask" styleClass="grid_4" mask="99.999-999" autocomplete="false" 
                                     readonly="true"
                                     value="#{managerImovel.imovel.cep}" >
                        </p:inputMask>
                        <div class="clear-both" />

                        <p:outputLabel value="Logradouro:" styleClass="grid_3" for="patioInputText" />
                        <p:inputText id="patioInputText" styleClass="grid_19" 
                                     readonly="true"
                                     value="#{managerImovel.imovel.codigoLogradouro.nomeLogradouro}" />
                        <div class="clear"/>

                        <p:outputLabel value="Bairro:" styleClass="grid_3" for="neighborhoodInputText" />
                        <p:inputText id="neighborhoodInputText" styleClass="grid_19"
                                     readonly="true"
                                     value="#{managerImovel.imovel.codigoDoBairro.nomeDoBairro}" />

                        <p:outputLabel value="Número:" styleClass="grid_3" for="numInputText" />
                        <p:inputText id="numInputText" styleClass="grid_4"
                                     readonly="true"
                                     value="#{managerImovel.imovel.numero}" />

                        <p:outputLabel value="Complemento:" styleClass="grid_4 alpha" for="compInputText" />
                        <p:inputText id="compInputText" styleClass="grid_11" readonly="true"
                                     value="#{managerImovel.imovel.codigoLogradouro.complemento}" />
                    </p:panel>
                </fieldset>

                <!--                <h4 class="title">Informações Sobre o Imóvel</h4>
                                <fieldset>
                                    <legend>Patrimônio</legend>                        
                                    <div class="clear"/>
                                    <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoDoPatrimonio}">
                                        <f:selectItem itemValue="1" itemLabel="Público" />
                                        <f:selectItem itemValue="2" itemLabel="Particular" />
                                        <f:selectItem itemValue="3" itemLabel="Religioso" />
                                    </p:selectOneRadio>
                                </fieldset>
                                <div class="clear"/>-->

                <h4 class="title">Caracteristicas do Imóvel</h4>

                <p:panel id="infGeralPanel" style="background: none; border: none;" > 

                    <!--                    <fieldset style="display: none">
                                            <legend>Topografia do Terreno</legend>
                                            <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoDaTopografia}">
                                                <f:selectItem itemValue="1" itemLabel="Plano" />
                                                <f:selectItem itemValue="2" itemLabel="Aclive" />
                                                <f:selectItem itemValue="3" itemLabel="Declive" />
                                            </p:selectOneRadio>
                                        </fieldset>
                                        <div class="clear"/>
                    
                                        <fieldset style="display: none">
                                            <legend>Situação do Terreno</legend>
                                            <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoSituacaoTerreno}">
                                                <f:selectItem itemValue="1" itemLabel="Esquina ou duas frentes" />
                                                <f:selectItem itemValue="2" itemLabel="Uma frente" />
                                                <f:selectItem itemValue="3" itemLabel="Encravado ou vila" />
                                            </p:selectOneRadio>
                                        </fieldset>
                                        <div class="clear"/>-->

                    <fieldset>
                        <legend>Tipo de Pedologia</legend>
                        <p:selectOneRadio styleClass="grid_3" value="#{managerImovel.imovel.codigoDaPedologia}">
                            <f:selectItem itemValue="1" itemLabel="Alagado" />
                            <f:selectItem itemValue="2" itemLabel="Inundável" />
                            <f:selectItem itemValue="3" itemLabel="Rochoso" />
                            <f:selectItem itemValue="4" itemLabel="Normal" />
                            <f:selectItem itemValue="5" itemLabel="Arenoso" />
                        </p:selectOneRadio>
                    </fieldset>
                    <!--                    <div class="clear"/>
                    
                                        <fieldset style="display: none">
                                            <legend>Utilização do Terreno</legend>
                                            <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoDaUtilizacao}">
                                                <f:selectItem itemValue="1" itemLabel="Terreno sem uso" />
                                                <f:selectItem itemValue="2" itemLabel="Residencial" />
                                                <f:selectItem itemValue="3" itemLabel="Comercial" />
                                                <f:selectItem itemValue="4" itemLabel="Prestação de serviço" />
                                                <f:selectItem itemValue="5" itemLabel="Industrial" />
                                            </p:selectOneRadio>
                                        </fieldset>
                                        <div class="clear"/>
                    
                                        <fieldset style="display: none">
                                            <legend>Isento TSU</legend>
                                            <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.isentoTsu}">
                                                <f:selectItem itemLabel="Sim" itemValue="S" /> 
                                                <f:selectItem itemLabel="Não" itemValue="N" />
                                            </p:selectOneRadio>
                                        </fieldset>
                                        <div class="clear"/>
                    
                                        <fieldset style="display: none">
                                            <legend>Uso do Imóvel</legend>
                                            <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoUso}">
                                                <f:selectItem itemValue="1" itemLabel="Alugado/Cedido" />
                                                <f:selectItem itemValue="2" itemLabel="Próprio" />
                                            </p:selectOneRadio>
                                        </fieldset>-->

                </p:panel>
                <!--                <div class="clear"/>
                
                                <h4 class="title">Informações Sobre a Edificação</h4>-->

                <!--                <p:panel id="infEdificacaoPanel" style="background: none; border: none;" > -->

                <!--                    <fieldset style="display: none">
                                        <legend>Caracterização do Imóvel</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoCaracterizacao}">
                                            <f:selectItem itemValue="1" itemLabel="Casa ou Apartamento" />
                                            <f:selectItem itemValue="2" itemLabel="Galpão ou Telheiro" />
                                            <f:selectItem itemValue="3" itemLabel="Loja" />
                                            <f:selectItem itemValue="4" itemLabel="Indústria" />
                                            <f:selectItem itemValue="5" itemLabel="Outros" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>-->

                <!--                    <fieldset>
                                        <legend>Tipo de Revestimento Externo</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codRevestimento}">
                                            <f:selectItem itemValue="1" itemLabel="Sem Revestimento" />
                                            <f:selectItem itemValue="2" itemLabel="Óleo" />
                                            <f:selectItem itemValue="3" itemLabel="Caiação" />
                                            <f:selectItem itemValue="4" itemLabel="Madeira" />
                                            <f:selectItem itemValue="5" itemLabel="Outros" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset>
                                        <legend>Tipo de Piso</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoPiso}">
                                            <f:selectItem itemValue="1" itemLabel="Terra Batida" />
                                            <f:selectItem itemValue="2" itemLabel="Cimento" />
                                            <f:selectItem itemValue="3" itemLabel="Cerâmica ou Mosaico" />
                                            <f:selectItem itemValue="4" itemLabel="Outros" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>-->

                <!--                    <fieldset>
                                        <legend>Tipo de Cobertura</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoDaCobertura}">
                                            <f:selectItem itemValue="1" itemLabel="Palha/Zinco/Cavaco" />
                                            <f:selectItem itemValue="2" itemLabel="Fibro ou Cimento" />
                                            <f:selectItem itemValue="3" itemLabel="Telha barro" />
                                            <f:selectItem itemValue="4" itemLabel="Laje" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset>
                                        <legend>Instalação Sanitária</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoInstSanitaria}">
                                            <f:selectItem itemValue="1" itemLabel="Inexistente" />
                                            <f:selectItem itemValue="2" itemLabel="Externa" />
                                            <f:selectItem itemValue="3" itemLabel="Interna" />
                                            <f:selectItem itemValue="4" itemLabel="Mais de uma interna" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset style="display: none">
                                        <legend>Posição do Imóvel</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoDaPosicao}">
                                            <f:selectItem itemValue="1" itemLabel="Isolada" />
                                            <f:selectItem itemValue="2" itemLabel="Geminada" />
                                            <f:selectItem itemValue="3" itemLabel="Superposta" />
                                            <f:selectItem itemValue="4" itemLabel="Conjugada" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>-->

                <!--                    <fieldset>
                                        <legend>Tipo de Construção</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoTipoConstrucao}">
                                            <f:selectItem itemValue="1" itemLabel="Alvenaria" />
                                            <f:selectItem itemValue="2" itemLabel="Taipa" />
                                            <f:selectItem itemValue="3" itemLabel="Madeira" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset>
                                        <legend>Estrutura do Imóvel</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoDaEstrutura}">
                                            <f:selectItem itemValue="1" itemLabel="Concreto" />
                                            <f:selectItem itemValue="2" itemLabel="Alvenaria" />
                                            <f:selectItem itemValue="3" itemLabel="Madeira" />
                                            <f:selectItem itemValue="4" itemLabel="Metalica" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset>
                                        <legend>Estado de Conservação do Imóvel</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codEstadoConservacao}">
                                            <f:selectItem itemValue="1" itemLabel="Bom" />
                                            <f:selectItem itemValue="2" itemLabel="Regular" />
                                            <f:selectItem itemValue="3" itemLabel="Ruim" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>-->

                <!--                    <fieldset>
                                        <legend>Tipo de Instalações Elétrica</legend>
                
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codInstEletrica}">
                                            <f:selectItem itemValue="1" itemLabel="Inexistente" />
                                            <f:selectItem itemValue="2" itemLabel="Aparente" />
                                            <f:selectItem itemValue="3"  itemLabel="Embutida" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>-->

                <!--                    <fieldset style="display: none">
                                        <legend>Fachada</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.codigoDaFachada}">
                                            <f:selectItem itemValue="1" itemLabel="Alinhada" />
                                            <f:selectItem itemValue="2" itemLabel="Recuada" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>-->

                <!--                    <h4 class="title">Serviços Urbanos</h4>
                
                                    <fieldset>
                                        <legend>Calçamento</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.calcamento}">
                                            <f:selectItem itemLabel="Sim" itemValue="S" /> 
                                            <f:selectItem itemLabel="Não" itemValue="N" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset>
                                        <legend>Iluminação Pública</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.iluminacaoPublica}">
                                            <f:selectItem itemLabel="Sim" itemValue="S" /> 
                                            <f:selectItem itemLabel="Não" itemValue="N" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset>
                                        <legend>Limpeza Pública</legend>
                
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.limpezaPublica}">
                                            <f:selectItem itemLabel="Sim" itemValue="S" /> 
                                            <f:selectItem itemLabel="Não" itemValue="N" />
                                        </p:selectOneRadio>
                                    </fieldset>
                                    <div class="clear"/>
                
                                    <fieldset>
                                        <legend>Coleta de Lixo</legend>
                                        <p:selectOneRadio styleClass="grid_3" value="{managerImovel.imovel.coletaDeLixo}">
                                            <f:selectItem itemLabel="Sim" itemValue="S" /> 
                                            <f:selectItem itemLabel="Não" itemValue="N" />
                                        </p:selectOneRadio>
                                    </fieldset>-->
                <!--                </p:panel>-->

                <hr/>

                <div class="clear"/>

                <div style="text-align: center">
                    <p:commandButton id="bt_next1" value="Próximo" icon="ui-icon-seek-next"
                                     update="@form" action="#{managerImovel.prox()}" />
                    <p:commandButton id="salvar1" value="Salvar" icon="ui-icon-disk"
                                     update="@form" action="#{managerImovel.atualizar()}" />
                
                </div>
            </h:form>

            <p:dialog id="iddlg" header="Visualizar Dados" widgetVar="dlg" modal="false"
                      showEffect="fade" hideEffect="fade" width="600" resizable="false" height="20">  
                <h:outputText value="Mudanças efetuadas" /> <br/> 
                <f:facet name="footer">

                    <p:outputLabel value="CPF/CNPJ:" styleClass="grid_3" for="cpfCnpjCheckBox" />
                    <p:selectBooleanCheckbox id="cpfCnpjCheckBox" value="#{managerImovel.cpfCnpj}" />

                    <p:outputLabel value="Pedologia:" styleClass="grid_3" for="pedologiaCheckBox" />
                    <p:selectBooleanCheckbox id="pedologiaCheckBox" value="#{managerImovel.pedologia}" />

                    <div class="clear"/>

                    <br/>

                    <center>

                        <p:commandButton value="Voltar" process="@this" onclick="dlgVisu.hide()" icon="ui-icon-close" />
                    </center>

                </f:facet>
            </p:dialog>

            <!--            <p id="back-top">
                            <a id="top" href="#top">
                                <span></span>
                            </a>
                        </p>
                        <p id="back-bottom">
                            <a id="bottom" href="#top">
                                <span></span>
                            </a>
                        </p>-->

        </ui:define>
    </ui:composition>
</html>
